using System;
using System.Collections.ObjectModel;
using System.Collections.Generic;
namespace ibba.src.noriskbo.Models
{
    public class Portfolio : ModelBase, IEquatable<Portfolio>
    {
        #region Atributos privados

        private int _idPortfolio;
        private int? _idIsda;
        private string _cdContrato;
        private int? _idOperacao;
        private DateTime _dtPortfolio;
        private decimal _vlThreshold;
        private decimal _vlMta;
        private int _vlPrazo;
        private decimal _pcHaircut;
        private decimal _vlMargem;
        private string _cdMoeda;
        private ObservableCollection<PortfolioCliente> _listaClientes;

        private DateTime _dtIniVig;
        private DateTime? _dtFimVig;

        #endregion

        #region Propriedades publicas

        public int IdPortfolio
        {
            set 
            { 
                _idPortfolio = value;
                OnPropertyChanged("IdPortfolio");
            }
            get { return _idPortfolio; }
        }

        public int? IdISDA
        {
            set 
            { 
                _idIsda = value;
                OnPropertyChanged("IdISDA");
            }
            get { return _idIsda; }
        }

        public string CdContrato
        {
            set
            {
                _cdContrato = value;
                OnPropertyChanged("CdContrato");
            }
            get { return _cdContrato; }
        }

        public int? IdOperacao
        {
            set
            {
                _idOperacao = value;
                OnPropertyChanged("IdOperacao");
            }
            get { return _idOperacao; }
        }

        public DateTime dtPortfolio
        {
            set 
            { 
                _dtPortfolio = value;
                OnPropertyChanged("dtPortfolio");
            }
            get { return _dtPortfolio; }
        }

        public decimal VlThreshold
        {
            set 
            { 
                _vlThreshold = value;
                OnPropertyChanged("VlThreshold");
            }
            get { return _vlThreshold; }
        }

        public decimal VlMTA
        {
            set 
            { 
                _vlMta = value;
                OnPropertyChanged("VlMTA");
            }
            get { return _vlMta; }
        }

        public int VlPrazo
        {
            set 
            { 
                _vlPrazo = value;
                OnPropertyChanged("VlPrazo");
            }
            get { return _vlPrazo; }
        }

        public decimal PcHaircut
        {
            set 
            { 
                _pcHaircut = value;
                OnPropertyChanged("PcHaircut");
            }
            get { return _pcHaircut; }
        }

        public decimal VlMargem
        {
            set 
            {
                _vlMargem = value;
                OnPropertyChanged("VlMargem");
            }
            get { return _vlMargem; }
        }

        public string CdMoeda
        {
            set
            {
                _cdMoeda = value;
                OnPropertyChanged("CdMoeda");
            }
            get { return _cdMoeda; }
        }

        public DateTime DtIniVig
        {
            set
            {
                _dtIniVig = value;
                OnPropertyChanged("DtIniVig");
            }
            get { return _dtIniVig; }
        }

        public DateTime? DtFimVig
        {
            set
            {
                _dtFimVig = value;
                OnPropertyChanged("DtFimVig");
            }
            get { return _dtFimVig; }
        }

        public ObservableCollection<PortfolioCliente> ListaClientes
        {
            set 
            { 
                _listaClientes = value;
                OnPropertyChanged("ListaClientes");
            }
            get { return _listaClientes; }
        }

        #endregion

        #region Construtores

        public Portfolio()
        {
            this.IdPortfolio = 0;
            this.IdISDA = null;
            this.CdContrato = String.Empty;
            this.IdOperacao = null;
            this.dtPortfolio = DateTime.Now;
            this.VlThreshold = 0;
            this.VlMTA = 0;
            this.VlPrazo = 0;
            this.PcHaircut = 0;
            this.VlMargem = 0;
            this.CdMoeda = String.Empty;
            this.DtIniVig = DateTime.Now.Date;
            this.DtFimVig = null;
            this.ListaClientes = new ObservableCollection<PortfolioCliente>();
        }

        #endregion

        #region Metodos

        public bool Equals(Portfolio other)
        {
            if (this.VlThreshold == other.VlThreshold &&
                this.VlMTA == other.VlMTA &&
                this.VlPrazo == other.VlPrazo &&
                this.PcHaircut == other.PcHaircut &&
                this.VlMargem == other.VlMargem &&
                this.CdMoeda == other.CdMoeda &&
                this.DtIniVig == other.DtIniVig &&
                this.DtFimVig == other.DtFimVig)

                return true;
            else
                return false;
        }

        #endregion
    }
}
